Skip to content

fetchart: Fix downloading pre-sized thumbnails from CAA#6870

Open
tibequadorian wants to merge 1 commit into
beetbox:masterfrom
tibequadorian:master
Open

fetchart: Fix downloading pre-sized thumbnails from CAA#6870
tibequadorian wants to merge 1 commit into
beetbox:masterfrom
tibequadorian:master

Conversation

@tibequadorian

Copy link
Copy Markdown

Description

Fixes issue in which thumbnails were rescaled locally instead of downloading pre-sized ones from CAA.

From the docs:

The CAA provides pre-sized thumbnails of width 250, 500, and 1200 pixels. If you set the maxwidth option to one of these values, the corresponding image will be downloaded, saving beets the need to scale down the image. It can also speed up the downloading process, as some cover arts can sometimes be very large.

I noticed that the fetchart plugin didn't download the pre-sized thumbnails from CAA for some of my releases because the API didn't provide them under the keys "500" and "250" but instead "large" and "small". These are legacy keys but for some releases they're the only ones available so I wrote this fix to use them as a fallback.

Example

curl -sL "https://coverartarchive.org/release/d51434bc-fcb6-4fc0-864f-e1ab13a51de2" | jq
{
  "images": [
    {
      "types": [
        "Front"
      ],
      "front": true,
      "back": false,
      "edit": 30140717,
      "image": "http://coverartarchive.org/release/d51434bc-fcb6-4fc0-864f-e1ab13a51de2/8891190287.png",
      "comment": "",
      "approved": true,
      "id": "8891190287",
      "thumbnails": {
        "large": "http://coverartarchive.org/release/d51434bc-fcb6-4fc0-864f-e1ab13a51de2/8891190287-500.jpg",
        "small": "http://coverartarchive.org/release/d51434bc-fcb6-4fc0-864f-e1ab13a51de2/8891190287-250.jpg"
      }
    }
  ],
  "release": "http://musicbrainz.org/release/d51434bc-fcb6-4fc0-864f-e1ab13a51de2"
}

@tibequadorian
tibequadorian requested a review from a team as a code owner July 23, 2026 01:55
@github-actions github-actions Bot added fetchart fetchart plugin thumbnails thumbnails plugin labels Jul 23, 2026
@github-actions

Copy link
Copy Markdown

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.63%. Comparing base (8778d0e) to head (ac9e34d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6870      +/-   ##
==========================================
- Coverage   75.63%   75.63%   -0.01%     
==========================================
  Files         163      163              
  Lines       21317    21318       +1     
  Branches     3361     3361              
==========================================
- Hits        16124    16123       -1     
- Misses       4403     4404       +1     
- Partials      790      791       +1     
Files with missing lines Coverage Δ
beetsplug/fetchart.py 74.18% <100.00%> (+0.03%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetchart fetchart plugin thumbnails thumbnails plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant